<!DOCTYPE html>
<html>
<head>
<meta http-equiv="Content-Type" content="text/html; charset=utf-8" />
<meta name="viewport" content="width=device-width, initial-scale=1.0, minimum-scale=1.0, user-scalable=no, maximum-scale=1.0"/>
<title>申请提现</title>
<meta content="yes" name="apple-mobile-web-app-capable" />
<meta content="black" name="apple-mobile-web-app-status-bar-style" />
<meta content="telephone=no" name="format-detection" />
<link href="../assets/mobile/comm.css" rel="stylesheet" type="text/css" />
<link href="../assets/mobile/member.css?v=130726" rel="stylesheet" type="text/css" />
<link href="../assets/mobile/invite.css?v=130726" rel="stylesheet" type="text/css" />
<link rel="stylesheet" href="../assets/mobile/top.css">
<link rel="stylesheet" href="../assets/agile/css/ratchet/css/ratchet.min.css">
<link rel="stylesheet" href="../assets/agile/css/flat/flat.component.css">
<link rel="stylesheet" href="../assets/agile/css/flat/iconline.css">
<link rel="stylesheet" href="../assets/app/css/app.css" />
<script type="text/javascript" src="../script/api.js"></script>
<script type="text/javascript" src="../script/jquery.js"></script>
<script type="text/javascript" src="../script/jquery.form.js"></script>
<script type="text/javascript" src="../script/config.js"></script>
<script type="text/javascript" src="../script/local.js"></script>
<script type="text/javascript" src="../script/common.js"></script>
<link href="../css/bootstrap/css/bootstrap.css" rel="stylesheet" type="text/css">
</head>
<style>
  .col-xs-2,.col-xs-3{
      height: 100%;
      justify-content:center;
      align-items:center;
      display:-webkit-flex;
      display:flex;
  }
    .text-order-color{
        color: #AAE6FF;
    }
    .text-price{
        color: #ff0000;
    }
    .text-status{
        color: #A0A0A0;
    }
    .text-size{
        font-size: 0.1em;
    }
    .no-p{
        padding: 0;
    }
    .col-xs-4{
        height: 100%;

    }
    .col-xs-8{
        height: 100%;
    }
    .text-size{
        font-size: 1.5em;line-height: 2em
    }
  .ba-m-t{
      background: #EFEFF3;
      height: 1em;
      margin-top: 0.2em
  }
    select{
        margin: 0;
    }
  .text-size2{
      font-size: 1.5em;
      line-height: 1.5em
  }

    .text-size-apply{
        font-size: 100%;
        line-height: 3em;
        height: 100%;
    }
    .h-max{
        height: 100%
    }
    .w-max{
        width: 100%
    }

    .go{
        width: 100%;
        height: 100%;
        padding: 0.5em;
        color: #ffffff;
        text-align: center;
        line-height: 2.5em;
        font-size: 1.3em;
        background: #FFC740;
        display: block;

    }
    a:hover,a:focus,a:visited,a:link,a:active,a{
        color: #ffffff;
        text-decoration:none;
    }
    .no-p-t-left-right{
        padding-top: 0;
        padding-right: 0;
        padding-left: 0;
    }
    .ffff{
        position: fixed;
        width: 100%;
        height: 100%;
        z-index: 10;
        display: none;
    }
    .ffff>.d{
        float: right;
        width: 50%;
        height: 100%;
        background: #ffffff;
        opacity: 1;
    }
    .ffff>.e{
        float: left;
        width: 50%;
        height: 100%;
        opacity: 0.5;
        background: #A7A6AB;
    }
    .xuanzhuan{
        -moz-transform:rotate(90deg);
        -webkit-transform:rotate(90deg);
        -o-transform:rotate(90deg);
        transform:rotate(90deg);
        filter:progid:DXImageTransform.Microsoft.BasicImage(rotation=1);
    }
    .input-border{
        border: 0;
    }

  input[type=text]{
      border: 0;
  }
    ul>li{
        padding:0.5em;
        text-align: left;
        font-size: 1.2em;
        border-bottom: 1px solid #c0c0c0;
    }
    .text-0{
        color: red;
    }
    .text-1{
        color: orange;
    }
    .text-2{
        color: green;
    }


  .all-apply{
      height: 2.5em;
      width: 100%;
      background: #ffffff;
      color: #000000;
      text-align: center;
      line-height: 2.5;
  }
  .go-apply-bg{
      height: 4em;
      width:100%;
      background: #F0EFF5;
      padding: 0.7em 2em 0.7em 2em;
  }
  .go-apply{
      background: #00B4FF;
      color: #ffffff;height: 100%;
      width: 100%;
      text-align: center;
      line-height: 1.5;
      padding: 0.5em;
      border-radius: 5px;
      display: block;


  }
  .h-100{
      height: 100%;
  }


  .h-3{
      height: 3em;
  }

  .h-4{
      height: 4em;
  }


  .line-1{
      height: 0.1em;
      border-bottom: 1px solid #D7D7D7
  }


  .line-7{
      height: 0.7em;
      background: #f5f5f5;
  }
  .h-100-mt-2{
      height:100%;
      margin-top: 0.2em
  }
    a,a:hover,a:focus,a:active,a:visited,a:link{
        color: #ffffff;
    }
    .icon-p5-pr10{
        padding: 5px;
        padding-right: 10px;
    }
.red{
    color: red;
}
.line-2{
    height: 0.1em;
    border-bottom: 0.7em solid #F0EFF5
}



</style>


<script>
    var righticon={
        change:function(e){


            var bankname=$(e).attr('data-bankname');
            var access=$(e).attr('data-access');
            var truename=$(e).attr('data-true-name');
            var cardid=$(e).attr('data-cardid');
            $('#bankName').html(bankname);
            $('#cardAccess').attr('value',access);
            $('#cardId').attr('value',cardid);
            $('#truename').attr('value',truename);


            $('.glyphicon.glyphicon-ok-circle.red').removeClass('red');
            $(e).children("span").addClass("red");

        },
        deleteBank:function(e){
            layer.open({
                content: '你是想确认删除吗？',
                btn: ['确认', '取消'],
                shadeClose: false,
                yes: function(){
                    var id=$(e).attr('data-delete');
                    righticon.send(id);
                    // console.log($(e).attr('data-delete'));
                    $(e).parent().css('display','none');
                    layer.open({content: '删除成功', time: 1});

                }, no: function(){

                }
            });


        },
        send:function(id){
            $.ajax({
                url:'/?/mobile/invite/deleteBank',
                data:{
                    id:id
                },
                type:"post",
                success:function(data){


                }


            })



        }
    }

</script>
<body>
<!-- 栏目页面顶部 -->

<!-- 内页顶部 -->
<style>
    #header{
        border:none;
    }
    #header,#header .titlebar{
        background-color:#DD3E96;
        color:#fff !important;
    }
    #header h1{
        color:#fff !important;
    }
    .pull-left,.pull-right{
        color:#fff !important;
    }
</style>
<!--
<header class="bar bar-nav hader-top" id="header" style="display: none">
    <a class="icon icon-left-nav pull-left" href="javascript:;"  id="close" ></a>
    <h1 class="title">常用账号</h1>
</header>
-->

<div id="openbank" class="ffff" style="z-index:99999999;padding-top:30px;">
    <div class="e" id="closebank">

    </div>
    <div class="d">
        <div style="border-bottom: 1px solid orange;font-size: 1.5em;padding: 0.7em;">选择银行</div>
        <ul style="overflow:auto;" class="bbank">
        </ul>

    </div>
</div>
<div id="open-win" style="height: 100%;width: 100%;display: none;background:#EFEFF3;overflow:auto;">
    <ul class="banklist">
    </ul>

</div>
<style>
    .add-f-h100-w10-d-c{
        float: right;
        height: 100%;
        width: 10%;
        display: inline-block;
        color: #000000;
    }
</style>

	<div id="wrapper"  style="display: block;position:static;top:0px;">
    <section class="clearfix g-member no-p-t-left-right" style="margin-top:0px !important;">
    <div class="container" style="margin-top:0px !important;">
        <div class="row h-4">
            <div class="h-100">
           <div class="h-100" style="width: 60%;float: left;">
               <div style="padding: 1.2em;text-align: center;font-size:120%;">提现金额：<span style="color: red;font-size:100%" class="applyPrice">￥0</span></div>
           </div>
           <div class="h-100" style="width: 40%;float: left" id="applyBalance">
               <a href="javascript:;"  class="go" style="display: block;color: #ffffff">转到余额</a>
           </div>
            </div>
        </div>
    </div>

<!--
        <a   id="open" style="height: 4em;display: block;color: #000000;border-top: 0.7em solid #F0EFF5;border-bottom: 0.7em solid #F0EFF5">
            <div style="display: inline-block;height: 100%;padding: 0.5em;padding-left: 1.3em;background: #ffffff">
                常用账号
            </div>
            <div style="float: right;width: 10%;height: 100%;text-align: center;padding: 0.7em;background: #ffffff">
                <i  class="ricon iconfont iconline-arrow-right"></i>
            </div>
        </a>



        <div style="height: 4em;background: #F0EFF5;padding-top: 0.7em;padding-bottom: 0.7em;">
            <div class="h-100" style="background: #ffffff;">
                <div style="float: left;width: 90%;padding: 0.5em;padding-left: 1.3em;height: 100%">常用卡号</div>
                <div style="float: left;width: 10%;padding:0.5em;height: 100%;text-align: center"><i  class="ricon iconfont iconline-arrow-right"></i></div>
          </div>
        </div>-->

<p></p>


        <a  id="selectbank"  style="height: 3em;display: block;width: 100%;color: #000;margin-top:10px;">
            <div style="margin-top: 0.2em;display: inline-block;width: 25%;height: 100%;text-align: center;line-height: 3em;">
                选择银行
            </div>
            <div style="width: 62%;height: 100%;display: inline;">
                <span id="bankName"></span>
            </div>
            <div style="float: right;width: 10%;height: 100%;text-align: center;padding: 1em;" class="xuanzhuan">
                <i  class="ricon iconfont iconline-arrow-right"></i>
            </div>

        </a>

    <!--    <div  class="h-3" id="selectbank">
            <div class="h-100-mt-2">
                <div style="float: left;width: 25%;height: 100%;padding-left: 0.5em;text-align: center;line-height:3">选择银行：</div>
                <div style="float: left;width: 62%;height: 100%;text-align: left;line-height: 3;">
                    <span id="bankName"></span>
                </div>
                <div style="float: left;width: 10%;height: 100%;text-align: center;" class="xuanzhuan"><i  class="ricon iconfont iconline-arrow-right"></i></div>

            </div>
        </div>-->

        <div class="line-1">
            &nbsp;
        </div>


        <div  class="h-3">
            <div class="h-100-mt-2">
                <div style="float: left;width: 25%;height: 100%;padding-left: 0.5em;text-align: center;line-height:3">开户支行：</div>
                <div style="float: left;width: 75%;height: 100%;text-align: center">
                    <input id="cardAccess" type="text" style="border: 0;padding-left: 0;" placeholder="请输入开户支行"/>
                </div>
            </div>
        </div>


        <div class="line-1">
            &nbsp;
        </div>




        <div  class="h-3">
            <div class="h-100-mt-2">
                <div style="float: left;width: 25%;height: 100%;padding-left: 0.5em;text-align: center;line-height:3">银行卡号：</div>
                <div style="float: left;width: 75%;height: 100%;text-align: center">
                    <input id="cardId" type="text" style="border: 0;padding-left: 0" placeholder="请输入银行卡号"/>
                </div>
            </div>
        </div>




        <div class="line-1">
            &nbsp;
        </div>


        <div  class="h-3">
            <div  class="h-100-mt-2">
                <div style="float: left;width: 25%;height: 100%;padding-left: 0.5em;text-align: center;line-height:3">真实姓名：</div>
                <div style="float: left;width: 75%;height: 100%;text-align: center">
                    <input id="truename" type="text"  style="border: 0;padding-left: 0"    placeholder="请输入真实姓名"/>
                </div>
            </div>
        </div>






        <div   class="go-apply-bg">
            <a href="javascript:;" class="go-apply"  id="post" style="color:#ffffff;">提交申请</a>
        </div>
		
		<p style="text-align:center;padding:10px;">申请提现金额大于100元</p>

        <div  class="all-apply">申请记录</div>

        <div  class="line-2">
            &nbsp;
        </div>


        <div class="container">
            <div class="row">
                <div class="col-xs-3 text-center">订单号</div>
                <div class="col-xs-3 text-center">金额</div>
                <div class="col-xs-3 text-center">时间</div>
                <div class="col-xs-3 text-center">状态</div>
            </div>
        </div>
        <div style="height: 0.1em;border-bottom: 1px solid #D7D7D7">&nbsp;</div>


        <div class="container orderlist">
        	<p style="padding:10px 0;text-align:center;">暂无数据</p>
        </div>
    </section>
    </div>

</body>
<script>
	
apiready = function(){
    $(function(){
		
	  var userinfo = getUserinfo();
	  if(!userinfo){
	  	$.PageDialog.fail('请登录用户');
		return;
	  }else{
	  	
		GetJPData(config.url+'/app.php?act=postapply&uid='+userinfo.uid,{},function(data){
			if(data['status']){
				$('.applyPrice').text('￥'+(data['applyprice']?data['applyprice']:0).toString());
				check.applyprice = data['applyprice']?data['applyprice']:0;
				var html = '';
				for(var i in data['orderinfo']){
					html += '<div class="row" >';
                	html += '<div class="col-xs-3 text-right">'+data['orderinfo'][i]['id']+'</div>';
                	html += '<div class="col-xs-3"><span style="color: red">'+data['orderinfo'][i]['price']+'</span></div>';
                	html += '<div class="col-xs-3">'+data['orderinfo'][i]['time']+'</div>';
                	html += '<div class="col-xs-3 text-'+data['orderinfo'][i]['status']+'">'+data['orderinfo'][i]['statu']+'</div></div>';
				}
				$('.orderlist').html(html);
				
				var bankhtml = '';
				for(var b in data['usebank']){
					   bankhtml += '<li style="background: #fff;margin-bottom: 10px;">';
			           bankhtml += '<div style="display: inline-block"><span  class="glyphicon glyphicon-user icon-p5-pr10" aria-hidden="true"></span><span>真实姓名：'+data['usebank'][b]['trueName']+'</span></div><a onclick="righticon.deleteBank(this)" data-delete="'+data['usebank'][b]['id']+'" class="add-f-h100-w10-d-c" style="color: #000000"> <span class="glyphicon glyphicon-trash" aria-hidden="true"></span></a>';
			           bankhtml += '<div><span  class="glyphicon glyphicon-credit-card icon-p5-pr10" aria-hidden="true"></span><span>银行卡号：'+data['usebank'][b]['cardId']+'</span></div>';
			           bankhtml += '<div style="display: inline-block"><span  class="glyphicon glyphicon-home icon-p5-pr10" aria-hidden="true"></span>银行名称：'+data['usebank'][b]['bankName']+'</div><a onclick="righticon.change(this)"  data-access="'+data['usebank'][b]['cardAccess']+'}" data-cardId="'+data['usebank'][b]['cardId']+'" data-bankName="'+data['usebank'][b]['bankName']+'" data-true-name="'+data['usebank'][b]['trueName']+'" class="add-f-h100-w10-d-c" style="color: #000000"><span class="glyphicon glyphicon-ok-circle" aria-hidden="true"></span></a>';
			      	   bankhtml += '</li>';
				}
				$('.banklist').html(bankhtml);
				
				var bank = '';
				for(var b in data['bank']){
					bank += '<li id="'+data['bank'][b]['id']+'">'+data['bank'][b]['bankName']+'</li>';
				}
				$('.bbank').html(bank);
	
        $('footer').remove();
        $('#wrapper').css('bottom','0px');
        $('#closebank').bind('click',function(){
            $('#openbank').css('display','none');
        });
        $('#selectbank').bind('click',function(){
             $('#openbank').css('display','block');
        });

        $('#openbank li').on('click',function(e){
             $('#bankName').html(e.target.innerHTML);
        });

        $('#close').on('click',function(){
            $('.bar.bar-nav.hader-top').css('display','none');
            $('#wrapper').css('display','block');
            $('#open-win').css('display','none');
        });


        $('#open').on('click',function(){
            $('.bar.bar-nav.hader-top').css('display','block');
            $('#wrapper').css('display','none');
            var height = $('#header')[0].clientHeight;
            $('#open-win').css('display','block').css('paddingTop',10+height+'px');
            $('#open-win').css('display','block').css('paddingBottom',10+height+'px');
        });
				
				
       $('#post').bind('click',function(){
	   	
		
			if(check.applyprice < 100){
				$.PageDialog.fail('当前余额小于100');
                return;
			}
		
           if(!check.checkPrice()){
		   	   $.PageDialog.fail('提现金额大于100');
               return;
           }


            if(!check.checkbankName()){
				$.PageDialog.fail('请选择银行名称');
                return;
            }
           if(!check.checknankAccess()){
		   		$.PageDialog.fail('请输入开户行地址');
               return;
           }
           if(!check.checkCardId()){
		   		$.PageDialog.fail('请输入银行卡号');
               return;
           }
           if(!check.checkCradTrueName()){
		   		$.PageDialog.fail('请输入真实姓名');
               return;
           }


            check.send();



       });

        $('#applyBalance').bind('click',function(){
			
            if(!check.checkPrice()){
				$.PageDialog.fail('当前余额为0');
                return;
            }

            check.sendBalance();

        });
				
				
			}else{
				$.PageDialog.fail(data['msg']);
			}
		});

} //if end

});
var check = {
		applyprice:0,
        checkbankName:function(){
           // $('#bankName').val();
            this.bankName = $('#bankName').html();

            if(this.bankName){

            }else{
                return false;
            }
            return true;
        },
    checknankAccess:function(){

        this.cardAccess=$('#cardAccess')[0].value;
        if(this.cardAccess.length>0){
            return true;
        }else{
            return false;
        }

    }
    ,
    checkCardId:function(){
        this.cardId=$('#cardId')[0].value;
        if(this.cardId.length>0){
            return true;
        }else{
            return false;
        }
    },
    checkCradTrueName:function(){
        this.truename=$('#truename')[0].value;
        if(this.truename.length>0){
            return true;
        }else{
            return false;
        }
    },
    checkPrice:function(){
        this.price = this.applyprice;
        if(this.price<=0){
            return false;
        }else{
            return true;
        }

    },
    send:function(){
		var userinfo = getUserinfo();
        $.ajax({
            url:config.url+'/app.php?act=shareApply&uid='+userinfo.uid,
            data:{
                truename:this.truename,
                bankName:this.bankName,
                cardId:this.cardId,
                cardAccess:this.cardAccess,
                price:this.price
            },
            type:"post",
            success:function(data){
                if(data['status']){
                    $.PageDialog.ok('<s></s>申请成功');
					setTimeout(function(){
						appClose('postapply',api);
					},1500);
                }else{
					$.PageDialog.fail('已提交申请未处理');
					setTimeout(function(){
						appClose('postapply',api);
					},1500);
                }

            }


        })

    },
    sendBalance:function(){
		var userinfo = getUserinfo();
        $.ajax({
            url:config.url+"/app.php?act=postMyBalance&uid="+userinfo.uid,
            data:{
                Money:this.applyprice
            },
            type:"post",
            success:function(data){
				
                    if(data['status']){
                      //  alert('转账成功');
						$.PageDialog.ok('<s></s>转账成功');
						localData.set('zok','yes');
						setTimeout(function(){
							appClose('postapply',api);	
						},2000);
                    }else{
						$.PageDialog.fail('转账失败,请检查余额');
                       
                    }

            }
        })
    }
};

};

</script>
</html>